#include <stdio.h>
int isLeap(int year,int m,int d,int *yue){
	if(year%400==0||(year%4==0&&year%100!=0)){
		if(m>2){
			printf("%d",yue[m-1]+d+1);
		}
		else
		printf("%d",yue[m-1]+d);
		
	}
	else
	printf("%d",yue[m-1]+d);
	
}
int main(){
	int y=0,m=0,d=0;
	int yue[12]={0,31,59,90,120,151,181,212,243,273,304,334};
	while(scanf("%d-%d-%d",&y,&m,&d)!=EOF){
		isLeap(y,m,d,yue);
		printf("\n");
	}
	return 0;
}
